$(function () {

    $('.btn_login').click(function () {
        var nick_name = $('#nick_name').val();
        var password = $('#password').val();
        var params = {
            'nick_name': nick_name,
            'password': password
        };
        $.ajax({
            url: "/passport/login",
            type: "post",
            data: JSON.stringify(params),
            contentType: "application/json",
        }).success(function (resp) {
            if (resp.errno == '0') {
                location.href = '/'
            } else {
                alert(resp.errmsg)
            }

        }).error(function () {
            alert('网络异常')
        })

    })
});